<template>
<div class="apply-success-container">
   <div class="apply-success-wrap">
      <div class="apply-success-name apply-success-title">
          <img src="../../assets/images/success.png">
          <h3>报名成功！</h3>
          <h6></h6>
      </div>
      <div class="course-info apply-info-detail">
           <h3>{{detail.freeactivity_title}}</h3>
          <p>{{filterHtml(detail.freeactivity_introduction)}}</p>
      </div>
      <div class="course-info apply-info apply-info-detail">
         <div class="apply-name">
              <h6>报名人姓名</h6>
              <span>{{detail.contact_name}}</span>
         </div>
         <div>
              <h6>联系方式</h6>
              <span>{{detail.contact_phonenumber}}</span>
         </div>
         <div>
              <h6>时间</h6>
              <span>{{conversionWeek(detail.week)}}</span>
         </div>
         <div>
              <h6>备注</h6>
              <span>{{detail.remarks}}</span>
         </div>
      </div>
   </div>
</div>

</template>

<script>
    import {FREEACTIVITY_APPLY_SUCCESS} from '../../api';
    import utilsMixin from '../../mixins/utilsMixin';
    export default {
        mixins:[utilsMixin],
        data(){
            return{
              query:this.$route.query,
              detail:{}
            }
        },
        methods:{
          getActivityDetail(){
           this.$http.get(FREEACTIVITY_APPLY_SUCCESS,{
             freeactivity_id:this.$route.params.activityId
           })
           .then(res =>{
               if(res.data.code ==0){
                 this.detail = res.data.data;
               }else{
                 this.$toast.show(res.data.message);
               }
           })
          },
          conversionWeek(weeks){
            if(!weeks){
              return ''
            }
            try{
              weeks = JSON.parse(weeks);
              if(typeof weeks === 'number'){
                weeks = [weeks];
              }

            }catch(e){
              weeks = [weeks];
            }

            let weekMap = ['一','二','三','四','五','六','天'];

            return weeks.map(item => '星期'+weekMap[item])
          }
        },
        ready(){
          this.getActivityDetail();
        },
        components:{

        }
    }
</script>
<style lang="sass">
     @import "../../sass/apply.scss"
</style>
